package cn.dnui_jzy913.dnuifood_16110100913.model;

import java.util.List;

import cn.dnui_jzy913.dnuifood_16110100913.bean.ShopBean;
import cn.dnui_jzy913.dnuifood_16110100913.common.Constants;
import cn.dnui_jzy913.dnuifood_16110100913.iface.ShopIface;
import cn.dnui_jzy913.dnuifood_16110100913.listener.RetrofitListener;
import cn.dnui_jzy913.dnuifood_16110100913.service.ShopService;
import retrofit2.Call;

/**
 * Created by Administrator on 2018/11/18.
 */
public class ShopModel extends BaseModel implements ShopIface {
    private ShopService shopService;
    public ShopModel(){
        this.shopService = retrofit.create(ShopService.class);
    }
    @Override
    public void getAllShops(final RetrofitListener listener) {
        Call<List<ShopBean>> call = shopService.getAllShops();
        bindCallback(call,listener,Constants.GETALLSHOPS);
    }

    @Override
    public void getShopById(String shop_id, RetrofitListener listener) {
        Call<ShopBean> call = shopService.getShopById(shop_id);
        bindCallback(call,listener,Constants.GETSHOPBYID);
    }

    @Override
    public void getFoodBySearch(String search, RetrofitListener listener) {
        Call call = shopService.getFoodBySearch(search);
        bindCallback(call,listener,Constants.GETFOODBYSEARCH);
    }


}
